//
//  HelpCenterViewController.m
//  LINNER
//
//  Created by Kendama on 2017/10/11.
//  Copyright © 2017年 weiwang. All rights reserved.
//

#import "HelpCenterViewController.h"

@interface HelpCenterViewController ()

@property(nonatomic,strong) UIImageView *containerView;

@end

@implementation HelpCenterViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

- (void)setNavigationStyle
{
    [self setNavigationBarTitle:MyNSLocalizedString(@"帮助中心")];
    [self setLeftButtonImage:[UIImage imageNamed:@"tittle_back_nor"]];
}

- (UIImageView *)containerView
{
    if(!_containerView)
    {
        UIView *superView = self.view;
        _containerView = [[UIImageView alloc]init];
        [superView addSubview:_containerView];
        _containerView.image = [UIImage imageNamed:MyNSLocalizedString(@"help_center_view_zh")];
    }
    return _containerView;
}

- (void)masLayoutSubview
{
    __weak UIView *superView = self.view;
    [self.containerView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(superView.mas_top).with.offset(64);
        make.left.right.bottom.mas_equalTo(superView);
    }];
}

- (NSString*)getPreferredLanguage
{
    
    NSUserDefaults * defaults = [NSUserDefaults standardUserDefaults];
    
    NSArray * allLanguages = [defaults objectForKey:@"AppleLanguages"];
    
    NSString * preferredLang = [allLanguages objectAtIndex:0];
    
    NSLog(@"当前语言:%@", preferredLang);

    if ([preferredLang isEqualToString:@"zh-Hans"] || [preferredLang isEqualToString:@"zh-Hans-CN"] || [preferredLang isEqualToString:@"zh-Hant"] || [preferredLang isEqualToString:@"zh-Hant-CN"] || [preferredLang isEqualToString:@"zh-Hant-HK"] || [preferredLang isEqualToString:@"zh-Hant-TW"] || [preferredLang isEqualToString:@"zh-Hant-MO"])
    {
        return @"zh";
    }
    else
    {
        return @"en";
    }
    
}

@end
